from captcha.image import ImageCaptcha
import random

# 标签0~9
CHAR_SET = [str(i) for i in range(10)]
CHAR_SET_LEN = len(CHAR_SET)
CAPTCHA_LEN = 1
IMG_SIZE = 64


# 生成训练集
for i in range(10):
    for j in range(200):
        text = CHAR_SET[i]
        img = ImageCaptcha(width=IMG_SIZE, height=IMG_SIZE)
        img.write(text, './train/' + text + '_' + str(j) + '.jpg')

# 生成测试集
for i in range(10):
    for j in range(50):
        text = CHAR_SET[i]
        img = ImageCaptcha(width=IMG_SIZE, height=IMG_SIZE)
        img.write(text, './test/' + text + '_' + str(j) + '.jpg')